//
//  WuLiGetShouyeRequest.m
//  WULIHH
//
//  Created by tang on 16/4/11.
//  Copyright © 2016年 tang. All rights reserved.
//

#import "WuLiGetShouyeRequest.h"
#import "AFNetworking.h"
#import "Header.h"

@implementation WuLiGetShouyeRequest




/*请求首页数据*/
+ (id)requestMianModelWithPage:(NSString *)pageString
{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    NSString *string = [NSString stringWithFormat:@"%@%@%@",hostName, shouyeshujuAPI,pageString];
    
    NSLog(@"%@", string);
    [manager GET:string parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
        // 这里可以获取到目前的数据请求的进度
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        // 请求成功，解析数据
        //        NSLog(@"%@", responseObject);
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves error:nil];
        
        [[NSNotificationCenter defaultCenter] postNotificationName:shouyeshuju object:nil userInfo:dic];
        
        //        NSLog(@"%@", dic);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        // 请求失败
        //        NSLog(@"%@", [error localizedDescription]);
    }];

    return self;
}



@end
